#ifndef SCREENCAPTURE_H
#define SCREENCAPTURE_H

#include <QThread>
#include <QPixmap>
#include <QTcpServer>
#include <windows.h>
#include <QTime>

class ScreenCapture : public QThread
{
    Q_OBJECT
public:
    ScreenCapture(WId wid, int port);
    ~ScreenCapture();
    void run();
private:
    QPixmap pixmap; // bitmap for storing screenshots
    QImage image;
    WId wid; // window id
    QTcpServer tcpserver;
    QTcpSocket *clientConnection;
    int resolutionX;
    int resolutionY;
    bool firstRun;
    QTime time2; // for timing time between updates
    int sum; // sum of execution time
    int number; // number of pictures send
    quint8 quality;

private slots:
    void serveClient();
    void doMousePress(int key, int x, int y);
    void doMouseMove(int x, int y);
    void doMouseRelease(int key, int x, int y);
    void doKeyPress(int key);
    void doKeyRelease(int key);
    void readFromClient();
};

#endif // SCREENCAPTURE_H
